/**
 * 所有网盘的登陆类 单例
 * @author William
 * 2012-5-10
 */
package com.ytu.clouddisk.clientlogin;

import java.io.IOException;

import android.content.Context;
import android.content.SharedPreferences;

import com.google.api.client.googleapis.auth.clientlogin.ClientLogin;
import com.google.api.client.http.HttpResponseException;
import com.ytu.clouddis.google.DocsControl;

public class LoginUtil {
//
//	private static LoginUtil instance;
//
//	public static LoginUtil getInstance(Context m) {
//		instance = new LoginUtil(m);
//		return instance;
//	}
//
//	private LoginUtil(Context c) {
//	}
//
//	/**
//	 * GOOGle 账户登陆
//	 * 
//	 * @param type
//	 * @return
//	 */
	public static String GoogleLogin(String user,String psd) {
		ClientLogin clientLogin;
		ClientLogin.Response response;
		clientLogin = new ClientLogin();
		response = new ClientLogin.Response();
		clientLogin.accountType = "GOOGLE";
		clientLogin.applicationName = "CloudDisk";
		clientLogin.authTokenType = "writely";

		clientLogin.username = user;
		clientLogin.password = psd; 

		try {
			response = clientLogin.authenticate();
		} catch (HttpResponseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return response.auth;
   }
}
